package com.corpgovernment.permission.mapper;

import com.corpgovernment.api.organization.model.bookingrelation.UidOrgIdEntry;
import com.corpgovernment.organization.common.mybatis.TkMapper;
import com.corpgovernment.permission.entity.db.MbUserRole;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author wangyujue
 */
@Repository
public interface UserRoleMapper extends TkMapper<MbUserRole> {

    MbUserRole findByAccountName(@Param("accountName") String staffNumber);

    List<MbUserRole> listByOrgId(@Param("orgId") String orgId, @Param("orgIdOfUid") String orgIdOfUid);

    List<MbUserRole> listRoleByOrgId(@Param("roleOrgIds") List<String> roleOrgIds);

    List<MbUserRole> fuzzyBgRoleByName(@Param("empName") String empName, @Param("roleId") Long roleId);

    List<MbUserRole> fuzzyByNameOrUserId(@Param("key") String content, @Param("userIds") List<String> userIds, @Param("roleIds") List<Long> roleIds);

    List<MbUserRole> fuzzyByOrgIdandUidorName(@Param("isBackground") Boolean isBackground, @Param("orgIds") List<String> orgIds, @Param("content") String content);

	List<MbUserRole> fuzzyByName(@Param("empName") String empName, @Param("userOrgIds") List<String> userOrgIds, @Param("roleIds") List<Long> roleIds, @Param("uids") List<String> uids, @Param("roleOrgIds") List<String> roleOrgIds);

	List<MbUserRole> fuzzyBgByUids(@Param("uids") List<String> uids, @Param("roleId") Long roleId, @Param("roleName") String roleName);

	List<MbUserRole> searchCorpEmp(@Param("orgIds") List<String> orgIds, @Param("name") String name);

	List<MbUserRole> fuzzyBgByNameNew(@Param("isBackground") boolean isBackground);

	int deleteUserRoleByOrgId(@Param("orgIdsOfRole") List<String> orgIdsOfRole, @Param("uIds") List<String> uIds, @Param("orgIdOfUid") String orgIdOfUid);

	List<MbUserRole> findByUid(@Param("uid") String uid);

	List<MbUserRole> findByUidAndOrgId(@Param("uid") String uid, @Param("orgId") String orgId);

	List<MbUserRole> fuzzyByUids(@Param("uids") List<String> uids, @Param("userOrgIds") List<String> userOrgIds, @Param("roleIds") List<Long> roleIds,  @Param("roleOrgIds") List<String> roleOrgIds);

    List<MbUserRole> batchSearchUserRoleIdByUidAndOrgId(@Param("uidOrgIds") List<UidOrgIdEntry> uidOrgIds);
}
